<cfcomponent output="false">
	<cfscript>
		
		/**
		* 	Constructor Method
		* 	@name constructor
		* 	@access public
		* 	@author Paulo Teixeira
		*	@date 2012-05-18
		*	@return Void
		**/
		public Void function constructor() {
			this.instance.name 		= "";
			this.instance.message 	= "";
		}
		
		/**
		* 	Handler error exception Throw
		* 	@name handlerError
		* 	@access public
		* 	@author Paulo Teixeira
		*	@date 2012-05-18
		*	@return Void
		**/
		public Void function handlerError( String name , String message ) {
			this.populate( argumentcollection : arguments ).showError();
		}
		
		/**
		* 	show the error exception Throw
		* 	@name showError
		* 	@access private
		* 	@author Paulo Teixeira
		*	@date 2012-05-18
		*	@return Void
		**/
		private Void function showError() {
			Throw( this.instance.name , this.instance.message );
		}
		
		/**
		* 	set name of error
		* 	@name setName
		* 	@access private
		* 	@author Paulo Teixeira
		*	@date 2012-05-18
		*	@return Error
		**/
		private Error function setName( String val ) {
			this.instance.name = arguments.val;
			
			return this;
		}
		
		/**
		* 	set message of error
		* 	@name setMessage
		* 	@access private
		* 	@author Paulo Teixeira
		*	@date 2012-05-18
		*	@return Error
		**/
		private Error function setMessage( String val ) {
			this.instance.message = arguments.val;
			
			return this;
		}
		
		/**
		* 	populate the setters
		* 	@name populate
		* 	@access private
		* 	@author Paulo Teixeira
		*	@date 2012-05-18
		*	@return Error
		**/				
		private Error function populate() {
			
			if( StructKeyExists( arguments , "name" ) ) {
				this.setName( arguments.name );
			}
			
			if( StructKeyExists( arguments , "message" ) ) {
				this.setName( arguments.message );
			}
			
			this.validate();
			
			return this;
			
		}
		
		/**
		* 	validate the setters
		* 	@name validate
		* 	@access private
		* 	@author Paulo Teixeira
		*	@date 2012-05-18
		*	@return Void
		**/	
		private Void function validate() {
			
			var isValid = true;
			
			if( Len( this.instance.name ) == 0 ) {
				isValid = false;
			}
			
			if( Len( this.instance.message ) == 0 ) {
				isValid = false;
			}
			
			if( isValid == false ) {
				this.handlerError( Application.config.customExceptionInternal , "Invalid Signature at ErrorHandler " );
			}
			
		}
		
	</cfscript>
</cfcomponent>